<template>
  <div class="app-container">
    <el-button type="primary" @click="print_this_code">print_this_code</el-button>
  </div>
</template>

<script>
import {getLodop} from '@/utils/LodopFuncs';
export default {
  data() {
    return {
      input: 5,
      msg: 'bra10-black-40D',
      bin: ['kwm-001', 'kwm-002', 'kwm-003']
    }
  },
  created() {},
  methods: {
    print_this_code(){
        this.$confirm('执行操作会产生打印，确定继续吗？', '警告', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
            })
                .then(() => {
                  var pid = 1;
                  let LODOP = getLodop();
                  console.log(LODOP);
                  
                  // for(let c = 0;c<1;c++ ){
                    LODOP.PRINT_INIT("入库码第1批");
                    LODOP.SET_PRINT_PAGESIZE(1,'40mm','20mm','');
                    LODOP.SET_PRINT_MODE("POS_BASEON_PAPER",true);

                      // for (let j = 1;j<=this.input;j++){
                      LODOP.NewPage();
                      // LODOP.SET_PRINT_STYLEA(0,"QRCodeVersion",7);
                      // LODOP.ADD_PRINT_BARCODE('4mm',5,'15mm','10mm',"QRCode",msg+':'+bin+':'+code);
                      LODOP.ADD_PRINT_BARCODE('1mm','1mm','20mm','20mm',"QRCode", this.msg);
                      //LODOP.SET_PRINT_STYLEA(0,"Angle",90);
                      LODOP.ADD_PRINT_TEXT('1mm','19mm','30mm','1mm',this.msg);
                      this.bin.forEach((value, n ) => {
                          const num_n = 3+(n+1)*3 +'mm';
                          LODOP.ADD_PRINT_TEXT(num_n,'19mm','22mm','1mm',value);
                      })
                      // }
                      LODOP.SET_PRINT_MODE("CUSTOM_TASK_NAME","入库码第1批");
                      //LODOP.PRINT_DESIGN();
                      LODOP.PRINT();
                  // }
                })
        
    },
  }
}
</script>

<style>

</style>